package com.example.demo.controller;

import com.example.demo.entity.userinfo;
import com.example.demo.service.UserinfoService;
import com.example.util.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by admin on 2018/9/25.
 */
@Controller
@CrossOrigin
@RequestMapping("user")
public class    UserinfoController extends BaseController {

    @Resource
    private UserinfoService userinfoService;

    @RequestMapping("/showuser")
    @ResponseBody
    public userinfo  toIndex(HttpServletRequest request, Model model){

        String username = request.getParameter("userName");
        userinfo userinfo = this.userinfoService.grtUserByid(username);
        return userinfo;

    }
}
